package com.example.demo.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.example.demo.myconverter.LocalDateTimeConverter;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 实体类与文件中的列要一一对应，不然会报转换异常，Date类型会报转换器找不到错误，所以用了String
 */
@Data
//@ContentRowHeight() //内容行高
//@HeadRowHeight()//表头行高
public class Category implements Serializable {

    //类型 1 菜品分类 2 套餐分类
    @ExcelProperty("菜品分类")
    private Integer type;

    //分类名称
    @ExcelProperty("分类名称")
    @ColumnWidth(20)
    private String name;

    //顺序
    @ExcelProperty("顺序")
    private Integer sort;

    //创建时间
    @ExcelProperty(value = "创建时间",converter = LocalDateTimeConverter.class)
    @ColumnWidth(30)//设置列宽
    @DateTimeFormat("yyyy-MM-dd")
    private LocalDateTime createTime;

    //更新时间
    @ExcelProperty(value = "更新时间",converter = LocalDateTimeConverter.class)
    @ColumnWidth(30)
    private LocalDateTime updateTime;

}